[Exchange 2010] [PowerShell] HasActivesyncDevicePartnership doesn't reflect actually having device partnership?
I have discovered that in our environment, running (Get-CASMailbox -ResultSize Unlimited -Filter {HasActivesyncDevicePartnership -eq $true}).Count Results in the answer "233". However, if I do this: $HasDevicePartnerships = Get-CASMailbox -ResultSize Unlimited -Filter {HasActiveSyncDevicePartnership -eq $true} $MailboxWithActiveSyncDevice = @() ForEach ($Mailbox in $HasDevicePartnerships) {If (Get-ActiveSyncDevice -Mailbox $Mailbox.Name) {$MailboxWithActiveSyncDevice += $Mailbox}} $MailboxWithActiveSyncDevice.Count ...I only receive an answer of "223", which is 10 less than have the HasActiveSyncDevicePartnership flag set to $true. What is the explanation for this? I've seen people report that all of their user mailboxes have the HasActiveSyncDevicePartnership flags set to $true, but that is not true here as we have over 1800 user mailboxes. I see that when you connect an ActiveSync device to a user's mailbox that didn't previously have one that the HasActiveSyncDevicePartnership flag sets to $true. Conversely when you do "Remove-ActiveSyncDevice -Identity <identity of an ActiveSync device>" and this removes the last ActiveSync device from a mailbox, then the HasActiveSyncDevicePartnership flag flips back to $false. So in what cases would HasActiveSyncDevicePartnership be set to $true but there be no actual ActiveSync devices attached to the mailbox, keeping in mind that no one in our organization has manually set this flag on any mailbox?
March 1st, 2012 2:39pm

On Thu, 1 Mar 2012 19:32:26 +0000, Scott W. Sander wrote: > > >I have discovered that in our environment, running (Get-CASMailbox -ResultSize Unlimited -Filter {HasActivesyncDevicePartnership -eq $true}).Count > > > >Results in the answer "233". However, if I do this: > >$HasDevicePartnerships = Get-CASMailbox -ResultSize Unlimited -Filter {HasActiveSyncDevicePartnership -eq $true} >$MailboxWithActiveSyncDevice = @() >ForEach ($Mailbox in $HasDevicePartnerships) {If (Get-ActiveSyncDevice -Mailbox $Mailbox.Name) {$MailboxWithActiveSyncDevice += $Mailbox}} >$MailboxWithActiveSyncDevice.Count > > > >...I only receive an answer of "223", which is 10 less than have the HasActiveSyncDevicePartnership flag set to $true. What is the explanation for this? I've seen people report that all of their user mailboxes have the HasActiveSyncDevicePartnership flags set to $true, but that is not true here as we have over 1800 user mailboxes. > >I see that when you connect an ActiveSync device to a user's mailbox that didn't previously have one that the HasActiveSyncDevicePartnership flag sets to $true. Conversely when you do "Remove-ActiveSyncDevice -Identity <identity of an ActiveSync device>" and this removes the last ActiveSync device from a mailbox, then the HasActiveSyncDevicePartnership flag flips back to $false. > >So in what cases would HasActiveSyncDevicePartnership be set to $true but there be no actual ActiveSync devices attached to the mailbox, keeping in mind that no one in our organization has manually set this flag on any mailbox? If all of the device partnerships have been removed from the mailbox it would still pass the "HasActiveSyncDevicePartnership" test. --- Rich Matheisen MCSE+I, Exchange MVP --- Rich Matheisen MCSE+I, Exchange MVP
Free Windows Admin Tool Kit Click here and download it now
March 1st, 2012 10:13pm

On Thu, 1 Mar 2012 19:32:26 +0000, Scott W. Sander wrote: > > >I have discovered that in our environment, running (Get-CASMailbox -ResultSize Unlimited -Filter {HasActivesyncDevicePartnership -eq $true}).Count > > > >Results in the answer "233". However, if I do this: > >$HasDevicePartnerships = Get-CASMailbox -ResultSize Unlimited -Filter {HasActiveSyncDevicePartnership -eq $true} >$MailboxWithActiveSyncDevice = @() >ForEach ($Mailbox in $HasDevicePartnerships) {If (Get-ActiveSyncDevice -Mailbox $Mailbox.Name) {$MailboxWithActiveSyncDevice += $Mailbox}} >$MailboxWithActiveSyncDevice.Count > > > >...I only receive an answer of "223", which is 10 less than have the HasActiveSyncDevicePartnership flag set to $true. What is the explanation for this? I've seen people report that all of their user mailboxes have the HasActiveSyncDevicePartnership flags set to $true, but that is not true here as we have over 1800 user mailboxes. > >I see that when you connect an ActiveSync device to a user's mailbox that didn't previously have one that the HasActiveSyncDevicePartnership flag sets to $true. Conversely when you do "Remove-ActiveSyncDevice -Identity <identity of an ActiveSync device>" and this removes the last ActiveSync device from a mailbox, then the HasActiveSyncDevicePartnership flag flips back to $false. > >So in what cases would HasActiveSyncDevicePartnership be set to $true but there be no actual ActiveSync devices attached to the mailbox, keeping in mind that no one in our organization has manually set this flag on any mailbox? If all of the device partnerships have been removed from the mailbox it would still pass the "HasActiveSyncDevicePartnership" test. --- Rich Matheisen MCSE+I, Exchange MVP --- Rich Matheisen MCSE+I, Exchange MVP
March 1st, 2012 10:20pm

Hi Did you try what Rich said? You can filter out those users who could not pass the command Get-ActiveSyncDevice And check their property in order to comfirm Cheers Zi FengZi Feng TechNet Community Support
Free Windows Admin Tool Kit Click here and download it now
March 5th, 2012 12:19am

Hi Did you try what Rich said? You can filter out those users who could not pass the command Get-ActiveSyncDevice And check their property in order to comfirm Cheers Zi FengZi Feng TechNet Community Support
March 5th, 2012 12:21am

In general I am having trouble understanding the HasActiveSyncDevicePartnership flag and what it really indicates. I just took a test user account that is mail-enabled and verified that the HasActiveSyncDevicePartnership flag was set to $false, linked my Android device to the mailbox, waited a few minutes, and then ran Get-CASMailbox -Identity "Jane Doe" | Select-Object Name, HasActiveSyncDevicePartnership and that flag is still set to $false. I don't understand that. If I do Get-ActiveSyncDevice -Mailbox "Jane Doe", I see the device I just added, but the HasActiveSyncDevicePartnership flag is still set to false. Also, I just ran these commands: $Mailboxes = Get-Mailbox -ResultSize Unlimited $MailboxesWithActiveSyncDevice = @() ForEach ($Mailbox in $Mailboxes) {If (Get-ActiveSyncDevice -Mailbox $Mailbox.Name) {$MailboxesWithActiveSyncDevice += $Mailbox}} $MailboxesWithActiveSyncDevice.Count ...and I got 236 as the result of the last command. If I run the second sequence of commands from my original post I still get 223. This means there are currently 13 mailboxes that have HasActiveSyncDevicePartnership set to $false but actually do have ActiveSync devices attached. What is the point of that flag if it doesn't represent reality?
Free Windows Admin Tool Kit Click here and download it now
March 5th, 2012 8:49am

Hi How about run the command to Check how many mailboxes that HasActiveSyncDevicePartnership set to $false (Get-CASMailbox -ResultSize Unlimited -Filter {HasActivesyncDevicePartnership -eq $false}).count Cheers Zi Feng TechNet Community Support
March 6th, 2012 1:22am

Hi How about run the command to Check how many mailboxes that HasActiveSyncDevicePartnership set to $false (Get-CASMailbox -ResultSize Unlimited -Filter {HasActivesyncDevicePartnership -eq $false}).count Cheers Zi Feng TechNet Community Support
Free Windows Admin Tool Kit Click here and download it now
March 6th, 2012 1:24am

(Get-Mailbox -ResultSize Unlimited).Count 1803 (Get-CASMailbox -ResultSize Unlimited -Filter {HasActiveSyncDevicePartnership -eq $false}).Count 1571 (Get-CASMailbox -ResultSize Unlimited -Filter {HasActiveSyncDevicePartnership -eq $true}).Count 232 1571 + 232 1803 $MailboxesWithActiveSyncDevice = @() ForEach ($Mailbox in (Get-Mailbox -ResultSize Unlimited)) {If (Get-ActiveSyncDevice -Mailbox $Mailbox.Name) {$MailboxesWithActiveSyncDevice += $Mailbox}} $MailboxesWithActiveSyncDevice.Count 234 I'm not sure what you are getting at here regarding looking at the results when checking for HasActiveSyncDevicePartnership set to $false. The number of mailboxes that have the flag set to $false plus the number set to $true equals the total number of mailboxes, as I'd expect. Therefore it is just as useless. But 234 and 232 are really close, right? That's true; however, not only is it still not accurate, but look at the results of the following code: $HasDevicePartnerships = Get-CASMailbox -ResultSize Unlimited -Filter {HasActiveSyncDevicePartnership -eq $true} $MailboxesWithActiveSyncDevice = @() ForEach ($Mailbox in $HasDevicePartnerships) {If (Get-ActiveSyncDevice -Mailbox $Mailbox.Name) {$MailboxesWithActiveSyncDevice += $Mailbox}} $MailboxesWithActiveSyncDevice.Count 222 If you look at my code in the last example, it filters for devices that have HasActiveSyncDevicePartnership set to $true and then among those results counts the mailboxes that actually do have ActiveSync devices attached, and it only comes up with 222 out of the 232. Yet there are actually 234 mailboxes that have ActiveSync device partnerships. This means that 12 mailboxes have ActiveSync devices attached but have HasActiveSyncDevicePartnership set to $false. It also means that 10 mailboxes have HasActiveSyncDevicePartnership set to $true, yet do not have ActiveSync devices attached.
March 6th, 2012 8:26am

On Tue, 6 Mar 2012 13:24:02 +0000, Scott W. Sander wrote: >(Get-Mailbox -ResultSize Unlimited).Count > >1803 (Get-CASMailbox -ResultSize Unlimited -Filter {HasActiveSyncDevicePartnership -eq $false}).Count > >1571 (Get-CASMailbox -ResultSize Unlimited -Filter {HasActiveSyncDevicePartnership -eq $true}).Count > >232 1571 + 232 > >1803 $MailboxesWithActiveSyncDevice = @() >ForEach ($Mailbox in (Get-Mailbox -ResultSize Unlimited)) {If (Get-ActiveSyncDevice -Mailbox $Mailbox.Name) {$MailboxesWithActiveSyncDevice += $Mailbox}} >$MailboxesWithActiveSyncDevice.Count > >234 > >I'm not sure what you are getting at here regarding looking at the results when checking for HasActiveSyncDevicePartnership set to $false. The number of mailboxes that have the flag set to $false plus the number set to $true equals the total number of mailboxes, as I'd expect. Therefore it is just as useless. But 234 and 232 are really close, right? That's true; however, not only is it still not accurate, but look at the results of the following code: $HasDevicePartnerships = Get-CASMailbox -ResultSize Unlimited -Filter {HasActiveSyncDevicePartnership -eq $true} >$MailboxesWithActiveSyncDevice = @() >ForEach ($Mailbox in $HasDevicePartnerships) {If (Get-ActiveSyncDevice -Mailbox $Mailbox.Name) {$MailboxesWithActiveSyncDevice += $Mailbox}} >$MailboxesWithActiveSyncDevice.Count > >222 > >If you look at my code in the last example, it filters for devices that have HasActiveSyncDevicePartnership set to $true and then among those results counts the mailboxes that actually do have ActiveSync devices attached, and it only comes up with 222 out of the 232. Yet there are actually 234 mailboxes that have ActiveSync device partnerships. This means that 12 mailboxes have ActiveSync devices attached but have HasActiveSyncDevicePartnership set to $false. It also means that 10 mailboxes have HasActiveSyncDevicePartnership set to $true, yet do not have ActiveSync devices attached. When an ActiveSync device is removed from the set of partnerships on the mailbox I don't thing the "HasActiveSyncDevicePartnership" is reset if the last device has been removed. Have you used the remove-activsyncdevice cmdlet? When you're doing your "Get-CASMailbox" you should add '-and -not Displayname -like "CAS_{*"; to the filter. I've also seen this situation on mailboxes that have been around since Exchange 2003 or that have been moved from another organziation. You can try this bit of code (the "-Whatif" is set to $true so all it'll do is produce the CSV file. I took this from a posting earlier (I forget who the original author was -- sorry) and neatened it up a bit. If the results look good you can set -Whatif to $false and rerun it. $badASPartnerships = @() Get-Mailbox -ResultSize unlimited | foreach { $mbxldn = $_.LegacyExchangeDN $casmbx = Get-CASMailbox -Identity $mbxldn -ResultSize 1 if($casmbx.HasActivesyncDevicePartnership -eq $true -and -not (Get-ActiveSyncDeviceStatistics -Mailbox $mbxldn) ) { $badASPartnerships += $casmbx | select SamAccountName,DisplayName,activeSyncMailboxPolicy,WhenCreated,DistinguishedName $casmbx | Set-CASMailbox -HasActiveSyncDevicePartnership:$false -Whatif:$true } } $badASPartnerships | Export-Csv ProblemPartnerships.csv -NoTypeInformation --- Rich Matheisen MCSE+I, Exchange MVP --- Rich Matheisen MCSE+I, Exchange MVP
Free Windows Admin Tool Kit Click here and download it now
March 6th, 2012 2:06pm

On Tue, 6 Mar 2012 13:24:02 +0000, Scott W. Sander wrote: >(Get-Mailbox -ResultSize Unlimited).Count > >1803 (Get-CASMailbox -ResultSize Unlimited -Filter {HasActiveSyncDevicePartnership -eq $false}).Count > >1571 (Get-CASMailbox -ResultSize Unlimited -Filter {HasActiveSyncDevicePartnership -eq $true}).Count > >232 1571 + 232 > >1803 $MailboxesWithActiveSyncDevice = @() >ForEach ($Mailbox in (Get-Mailbox -ResultSize Unlimited)) {If (Get-ActiveSyncDevice -Mailbox $Mailbox.Name) {$MailboxesWithActiveSyncDevice += $Mailbox}} >$MailboxesWithActiveSyncDevice.Count > >234 > >I'm not sure what you are getting at here regarding looking at the results when checking for HasActiveSyncDevicePartnership set to $false. The number of mailboxes that have the flag set to $false plus the number set to $true equals the total number of mailboxes, as I'd expect. Therefore it is just as useless. But 234 and 232 are really close, right? That's true; however, not only is it still not accurate, but look at the results of the following code: $HasDevicePartnerships = Get-CASMailbox -ResultSize Unlimited -Filter {HasActiveSyncDevicePartnership -eq $true} >$MailboxesWithActiveSyncDevice = @() >ForEach ($Mailbox in $HasDevicePartnerships) {If (Get-ActiveSyncDevice -Mailbox $Mailbox.Name) {$MailboxesWithActiveSyncDevice += $Mailbox}} >$MailboxesWithActiveSyncDevice.Count > >222 > >If you look at my code in the last example, it filters for devices that have HasActiveSyncDevicePartnership set to $true and then among those results counts the mailboxes that actually do have ActiveSync devices attached, and it only comes up with 222 out of the 232. Yet there are actually 234 mailboxes that have ActiveSync device partnerships. This means that 12 mailboxes have ActiveSync devices attached but have HasActiveSyncDevicePartnership set to $false. It also means that 10 mailboxes have HasActiveSyncDevicePartnership set to $true, yet do not have ActiveSync devices attached. When an ActiveSync device is removed from the set of partnerships on the mailbox I don't thing the "HasActiveSyncDevicePartnership" is reset if the last device has been removed. Have you used the remove-activsyncdevice cmdlet? When you're doing your "Get-CASMailbox" you should add '-and -not Displayname -like "CAS_{*"; to the filter. I've also seen this situation on mailboxes that have been around since Exchange 2003 or that have been moved from another organziation. You can try this bit of code (the "-Whatif" is set to $true so all it'll do is produce the CSV file. I took this from a posting earlier (I forget who the original author was -- sorry) and neatened it up a bit. If the results look good you can set -Whatif to $false and rerun it. $badASPartnerships = @() Get-Mailbox -ResultSize unlimited | foreach { $mbxldn = $_.LegacyExchangeDN $casmbx = Get-CASMailbox -Identity $mbxldn -ResultSize 1 if($casmbx.HasActivesyncDevicePartnership -eq $true -and -not (Get-ActiveSyncDeviceStatistics -Mailbox $mbxldn) ) { $badASPartnerships += $casmbx | select SamAccountName,DisplayName,activeSyncMailboxPolicy,WhenCreated,DistinguishedName $casmbx | Set-CASMailbox -HasActiveSyncDevicePartnership:$false -Whatif:$true } } $badASPartnerships | Export-Csv ProblemPartnerships.csv -NoTypeInformation --- Rich Matheisen MCSE+I, Exchange MVP --- Rich Matheisen MCSE+I, Exchange MVP
March 6th, 2012 10:04pm

HI: I have experienced this same problem. I have a powershell query that pulls mailbox data for only those user's that have activesync device partnerships established: Get-CASMailbox -ResultSize:Unlimited -filter HasActiveSyncDevicePartnership -eq $true' The filter relies on the accuracy of the HasActiveSyncDevicePartnership property on the mailbox. I have seen this property with a value of "True" when there are no device partnerships and I have seen this property with a value of "False" when there are device partnerships present. Very frustrating and it seems that this property cannot be relied upon to be accurate. I have never seen this problem occur in an Exchange 2007 environment. And, in fact have only seen this problem in Exchange 2010 when the DefaultAccessLevel Organization setting is "Quarantine". Can someone at Microsoft please explain how this flag gets updated? For me, it is an efficiency issue. I don't want to include mailboxes in my query collection that do not have device partnerships. Also, I really do not want to have to use a filter that relies on calling the Get-ActivesyncDeviceStatistics cmdlet to determine if a device partnership exists. Bottom line is that the HasActiveSyncDevicePartnership property should be an accurate indicator. Right now, unfortunately, it looks like this property is, in fact, inaccurate in some situations.
Free Windows Admin Tool Kit Click here and download it now
May 23rd, 2012 3:34pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics